package com.cqq.print.base.service.impl;


import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cqq.common.core.bean.PageInfoBean;
import com.cqq.print.base.dao.PStandardDao;
import com.cqq.print.base.dao.domain.PStandard;
import com.cqq.print.base.service.bean.PStandardBean;


/**
 * @author generated
 * @date 2015-08-29
 */


@Service(value="pStandardService")
public class PStandardServiceImpl implements com.cqq.print.base.service.PStandardService{

             @Autowired
             private PStandardDao pStandardDao;

			
			public PageInfoBean<PStandardBean> queryPagePPublisher(
					Map<String, Object> map) {
				List<PStandardBean> listPSBean = null;
				int count = pStandardDao.queryAllPStandardCount(map);
				List<PStandard> listPS = pStandardDao.queryAllPStandard(map);
				if(listPS!=null&&listPS.size()>0){					
					listPSBean = new ArrayList<PStandardBean>();
					for (PStandard ps : listPS) {
						PStandardBean psBean = new PStandardBean();
						BeanUtils.copyProperties(ps, psBean);
						listPSBean.add(psBean);
					}
				}
				return new PageInfoBean<PStandardBean>(listPSBean, count);
			}

			
			public List<PStandardBean> queryPStandard() {
				List<PStandard> listPS = pStandardDao.queryPStandard();
				if(listPS==null||listPS.size()<1)
					return null;
				List<PStandardBean> listPSBean = new ArrayList<PStandardBean>();
				for (PStandard ps : listPS) {
					PStandardBean psBean = new PStandardBean();
					BeanUtils.copyProperties(ps, psBean);
					listPSBean.add(psBean);
				}
				return listPSBean;
			}

			
			public PStandardBean findPStandardBean(Integer id) {
				PStandard ps = pStandardDao.selectByPrimaryKey(id);
				if(ps==null)
					return null;
				PStandardBean psBean = new PStandardBean();
				BeanUtils.copyProperties(ps, psBean);
				return psBean;
			}

}